home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga News 95
/
Amiga News 95.iso
/
dpat
/
dpat96
/
klondike_adptools_v1.1
/
datas
/
english.lha
/
4-CreateCardset.adpro
< prev
Wrap
Text File
|
1995-04-15
|
5KB
|
215 lines
/*
** CreateCardset.adpro :
** This ARexx script for ADPro v2.5 or higher, make a Klondike cardset with
** the tool 'reko', and finally save it.
** NORMALLY ONLY USED IF 3-RenderCardset.adpro FAILED !!
**
** Klondike & Reko tools © Copyright Reko Produtions - All rights reserved.
**
** $VER: CreateCardset/English v1.1 (06.04.95) © Copyright Lejardinier Olivier - All rights reserved
**
*/
ADDRESS "ADPro"
OPTIONS RESULTS
NL = '0A'X
FALSE = 0
TRUE = 1
/*
** Save the current environment.
*/
TempDefaults = "T:TempADProDefaults"
SAVE_DEFAULTS TempDefaults
/*
** Initializations.
*/
CLOSE_RENDER_SCREEN
CLEAR_RENDERED
CLEAR_RAW
PSTATUS "UNLOCKED"
ADPRO_TO_FRONT
/*
** Get cards files.
*/
Continue = FALSE
DO UNTIL ( Continue = TRUE )
GETFILE '"Select first card :"'
IF (RC ~= 0) THEN
DO
Text = "You MUST select a rendered card !"
OKAYN '"Error :"' '"'Text'"' '"Select|Abort"'
IF ( RC = 0 ) THEN
CALL ForceExit
END
ELSE
DO
SourceDir = ADPRO_RESULT
Continue = TRUE
END
END
FirstChar = LEFT( SourceDir , 1 )
IF ( (FirstChar = '"') | (FirstChar = '''') ) THEN
SourceDir = STRIP( SourceDir, "B" , FirstChar )
FNameSepPos = LASTPOS( '/' , SourceDir )
IF ( FNameSepPos = 0 ) THEN
FNameSepPos = LASTPOS( ':' , SourceDir )
IF ( FNameSepPos ~= 0 ) THEN
DO
Basename = RIGHT( SourceDir , LENGTH( SourceDir ) - FNameSepPos )
SourceDir = LEFT( SourceDir , FNameSepPos )
IF ( LASTPOS( '.' , Basename ) ~= 0 ) THEN
Basename = DELSTR( Basename , LASTPOS( '.' , Basename ) )
END
ELSE
CALL ForceExit
/*
** Get type of cardset.
*/
Text = "- 55 cards (standard) " || NL || "- 59 cards (extra cards)"
OKAYN '"Select type of cardset :"' '"'Text'"' '"55|59|Abort"'
IF ( RC = 0 ) THEN
CALL ForceExit
ELSE
IF ( RC = 1 ) THEN
NumberOfCards = 55
ELSE
NumberOfCards = 59
/*
** Check all created cards.
*/
Continue = TRUE
Index = 0
DO WHILE ( Index <= NumberOfCards - 1 )
IF ( Index < 10 ) THEN
Cardname = SourceDir || Basename || ".00" || Index
ELSE
IF ( Index < 100 ) THEN
Cardname = SourceDir || Basename || ".0" || Index
ELSE
Cardname = SourceDir || Basename || "." || Index
IF ( ~EXISTS( Cardname ) ) THEN
DO
Continue = FALSE
Text = "Sorry, Card" || Index " not found !"
OKAYN '"Error :"' '"'Text'"' '"Check next|Quit"'
IF ( RC = 0 ) THEN
CALL ForceExit
ELSE
Index = Index + 1
END
ELSE
Index = Index + 1
END
IF ( Continue = FALSE ) THEN
DO
Text = "Some cards aren't correctly rendered or missing." || NL || "You should run 3-RenderCardset.adpro to retry."
OKAYN '"Infos :"' '"'Text'"' '"Quit"'
CALL ForceExit
END
/*
** Make final cardset.
*/
DestDir = SourceDir
Continue = FALSE
DO UNTIL ( Continue = TRUE )
Title = "Place" Basename || ".REKO in ? :"
GETDIR '"'Title'"' '"'DestDir'"'
IF ( RC = 0 ) THEN
DO
ToDir = ADPRO_RESULT
IF ( ( RIGHT( ToDir , 1 ) ~= "/" ) & ( RIGHT( ToDir , 1 ) ~= ":" ) ) THEN
ToDir = ToDir || "/"
Continue = TRUE
END
ELSE
DO
Text = "Use :" || NL || DestDir || NL || "as output directory ?"
OKAYN '"Confirm :"' '"'Text'"' '"Use|Select|Abort"'
IF ( RC = 0 ) THEN
CALL ForceExit
ELSE
IF ( RC = 1 ) THEN
DO
ToDir = DestDir
Continue = TRUE
END
END
END
Continue = FALSE
DO UNTIL ( Continue = TRUE )
PRAGMA( 'D' , STRIP( DestDir , 'T' , '/' ) )
ADDRESS COMMAND "C:Reko" Basename || ".000" NumberOfCards
IF ( ~EXISTS( DestDir || "Card.REKO" ) ) THEN
DO
Text = "Unable to create final cardset" Basename || ".REKO" || NL || "Perhaps not enought disk space or memory."
OKAYN '"Error :"' '"'Text'"' '"Retry|Abort"'
IF ( RC = 0 ) THEN
CALL ForceExit
END
ELSE
DO
Continue = TRUE
ADDRESS COMMAND 'C:Filenote FILE="' || DestDir || 'Card.REKO" COMMENT="Created with Klondike ADPTools © 1995 Lejardinier Olivier"'
END
END
CardsetDir = ToDir
FromDir = DestDir || "Card.REKO"
IF ( ToDir ~= DestDir ) THEN
DO
ToDir = ToDir || Basename || ".REKO"
ADDRESS COMMAND "C:Copy FROM" FromDir ToDir "COM QUIET"
ADDRESS COMMAND "C:Delete >NIL: FILE" FromDir "QUIET"
END
ELSE
DO
ToDir = ToDir || Basename || ".REKO"
ADDRESS COMMAND "C:Rename FROM" FromDir "AS" ToDir "QUIET"
END
Text = "You can find the cardset" Basename || ".REKO in directory :" || NL || CardsetDir
OKAYN '"Infos :"' '"'Text'"' '"Quit"'
/*
** Quit.
*/
ForceExit:
CLOSE_RENDER_SCREEN
CLEAR_RENDERED
CLEAR_RAW
IF ( EXISTS( TempDefaults ) ) THEN
DO
LOAD_DEFAULTS TempDefaults
IF (RC ~= 0) THEN
OKAY1 "Unable to restore old settings."
ADDRESS COMMAND "C:Delete >NIL: FILE" TempDefaults "QUIET"
END
EXIT 0
RETURN